package com.example.arithmeticleetcode.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-05-13 09:56
 **/
public class Demo17 {

    public static void main(String[] args) {
        int[] arr = {-2, 0, 10, -19, 4, 6, -8};
        int[] arr1 = {0, 0};
        System.out.println(checkIfExist(arr));
        System.out.println(checkIfExist(arr1));
    }

    public static boolean checkIfExist(int[] arr) {
        List<Integer> list = new ArrayList<>(arr.length);

        int zeroCount = 0;

        for (int i : arr) {
            list.add(i * 2);
            if (i == 0) {
                zeroCount++;
            }
        }
        if (zeroCount > 1) {
            return true;
        }

        System.out.println(list);
        for (int i : arr) {
            if (list.contains(i) && i != 0) {
                return true;
            }
        }

        return false;
    }
}
